﻿<style>
    .useritem {
    }

    .userinfo {
    }
</style>

<from class="layui-form layui-form-pane" action="">
    <input type="hidden" name="id">
    <div class="layui-form-item">
        <label class="layui-form-label">移交人</label>
        <div class="layui-input-block">
            <select name="userId" id="userId">
                <option value="none">选择移交人</option>
            </select>
        </div>
    </div>
    <div class="layui-form-item" style="text-align: center;">
        <button class="layui-btn" lay-submit="" lay-filter="project-move">确认移交</button>
    </div>
</from>
<div>
    <div></div>
    <div></div>
</div>
<script type="text/javascript">
    layui.define(['layer', 'form'], function (exports) {
        var form = layui.form;
        form.render("select"); //这个很重要
        var id = workUtils.get("id");
        $("[name='id']").val(id);
        workUtils.ajaxGet("../project/projectuser", {
            projectId: id
        }, function (data) {
            var optionstring = "";
            $.each(data, function (i, item) {
                optionstring += "<option value=\"" + item.user.id + "\" >" + item.user.name + "</option>";
            });
            $("#userId").html('<option value=""></option>' + optionstring);
            form.render('select'); //这个很重要
        });

        form.on('submit(project-move)', function (data) {
            var index = layer.load(1);
            setTimeout(function () {
                workUtils.ajaxPost('../project/move', data.field, function (result) {
                    layer.close(index);
                    workUtils.msg(result,function () {
                        loadProject();
                    });
                });
            }, 400);
            return false;
        });
    });


</script>